#ifndef ODN_NETWORKMANAGER_H
#define ODN_NETWORKMANAGER_H

#include <RakNet\RakPeerInterface.h>
#include <RakNet\RakServerInterface.h>
#include <RakNet\RakClientInterface.h>
#include <RakNet\RakNetworkFactory.h>
#include <RakNet\BitStream.h>
#include <RakNet\Multiplayer.h>

#include <iostream>

#include "ODN_String.h"
/*
template <class interfaceType>
class INetworkState : public Multiplayer<interfaceType>, public IGameState

class CClientPlayState : public INetworkState<RakClientInterface>
class CServerPlayState : public INetworkState<RakServerInterface>
*/
namespace ouden {

class INetworkManager
{

public:

	virtual void processPackets() = 0;

};

class CClientManager : public INetworkManager, public Multiplayer<RakClientInterface>
{
public:
	CClientManager(String sHostAddress, unsigned short iServerPort, unsigned short iClientPort);
	virtual ~CClientManager();

	virtual void processPackets() 		{ ProcessPackets(m_pClient); }

protected:
	/*
	virtual void ReceiveConnectionAttemptFailed( Packet *packet, RakClientInterface *interfaceType )
	{

		Multiplayer<RakClientInterface>::ReceiveConnectionAttemptFailed(packet, interfaceType);

		std::cout << "*************Failed to connect" << std::endl;

	}
	*/
private:

	RakClientInterface* m_pClient;

};

class CServerManager : public INetworkManager, public Multiplayer<RakServerInterface>
{
public:
	CServerManager(unsigned short iMaxPlayers, unsigned short iServerPort);
	virtual ~CServerManager();

	virtual void processPackets() 		{ ProcessPackets(m_pServer); }

protected:
private:

	RakServerInterface* m_pServer;

};

} //namespace ouden

#endif // ODN_NETWORKMANAGER_H
